package controllers;

import java.util.HashMap;
import java.util.StringTokenizer;

public class ControllerUtil {
	public static HashMap<String,String> searchParser(String query){
		int kwCount=0;
		HashMap<String,String> vals=new HashMap<String,String>();
		if (query.contains(";")){
			StringTokenizer strTok=new StringTokenizer(query,";");
			while(strTok.hasMoreTokens()){
				String tk=strTok.nextToken();
				if (tk.contains(":")){
					StringTokenizer strTok1=new StringTokenizer(tk,":");
					vals.put(strTok1.nextToken(), strTok1.nextToken());
				}
				else vals.put("KeyWord"+(kwCount++),tk);
			}
		}
		return vals;
	}
}
